<template>
  <div>
    登陆人：{{ route.query.U_Name }} 管理员
    <h2>显示</h2>
    项目名称：<input type="text" v-model="sdata.T_Name" /> 投资项目总金额:<input
      type="text"
      v-model="sdata.max"
    />--<input type="text" v-model="sdata.min" />
    <input type="button" value="查询" @click="Show()" />
    <table class="table table-bordered">
      <thead>
        <tr>
          <td>投资编号</td>
          <td>投资名称</td>
          <td>总金额</td>
          <td>最低金额</td>
          <td>投资人数</td>
          <td>操作</td>
        </tr>
      </thead>
      <tbody>
        <tr v-for="a in list">
          <td>{{ a.T_Id }}</td>
          <td>{{ a.T_Name }}</td>
          <td>{{ a.T_Year }}</td>
          <td>{{ a.T_Money }}</td>
          <td>{{ a.T_Nuber }}</td>
          <td>
            <input type="button" value="查看详情" @click="go(a.T_Id)" />
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script setup lang="ts">
import { reactive, toRefs, onMounted } from 'vue';
import axios from 'axios';
import { useRoute, useRouter } from 'vue-router';
let router = useRouter();
let route = useRoute();

let data: any = reactive({
  sdata: {
    T_Name: '',
    max: '',
    min: ''
  },
  list: {}
});
let { sdata, list } = toRefs(data);

onMounted(() => {
  Show();
});

const Show = () => {
  axios({
    url: 'http://localhost:53547/api/User/UserTouZi',
    method: 'get',
    params: sdata.value
  }).then((res) => {
    console.log(res);
    list.value = res.data.data;
  });
};

const go = (T_Id: any) => {
  router.push({
    path: '/gai',
    query: {
      T_Id: T_Id
    }
  });
};
</script>

<style scoped></style>
